package cn.john.hrm.client;

import cn.john.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserInfoFallbackFactory implements FallbackFactory<UserInfoFeignClient> {

    @Override
    public UserInfoFeignClient create(Throwable throwable) {
        return new UserInfoFeignClient() {
            @Override
            public AjaxResult getUserInfo(Long loginId) {
                return AjaxResult.me().setSuccess(false).setMessage("对不起，获取用户信息失败!!!");
            }
        };
    }
}
